package dryven.view.engine.parser.parts;

import java.io.IOException;
import java.io.Writer;

import dryven.codegen.asm.MethodBuilder;
import dryven.view.ViewDataDictionary;
import dryven.view.engine.parser.ViewComponentLocator;
import dryven.view.engine.parser.ViewDataDeclarationCollection;

public class TextPart implements CompiledViewPart {

	private String _text;
	
	public TextPart(String text) {
		super();
		_text = text;
	}

	@Override
	public void evaluate(ViewDataDictionary viewData, Writer out, ViewDataDeclarationCollection declarations) throws IOException {
		out.write(_text);
	}

	@Override
	public void writeInstructions(MethodBuilder builder) {
		// TODO Auto-generated method stub
	}

	@Override
	public void compile(ViewDataDeclarationCollection declarations, ViewComponentLocator locator) {}

	public void append(TextPart part) {
		_text = _text+part._text;
	}
	
	public String getText() {
		return _text;
	}
}
